package com.clayecloud.common.client.controller;

import cn.hutool.json.JSONObject;
import com.clayecloud.common.annotation.NoAuthorization;
import com.clayecloud.common.utils.MessageUtil;
import com.clayecloud.common.utils.QRCodeUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @author ClayeLink
 * @date 2022/3/26 10:17
 */
@RestController
@RequestMapping("/qrcode")
@Api(tags = "二维码接口")
public class ClientQRCodeController {
    /**
     * 获取用户认证二维码
     * @return
     */
    @GetMapping("/getAuthorizationQRCode")
    @ApiOperation("获取用户认证二维码")
    @NoAuthorization
    public MessageUtil getAuthorizationQRCode(String token){
        JSONObject content = new JSONObject();
        content.set("code", 1000);
        content.set("content", token);
        return MessageUtil.success("生成成功").add(QRCodeUtil.getBase64QRCode(content.toString()));
    }
}
